Re: [SQL] Does PostgreSQL have an UPDATE Function like UNIFY?

Поиск
Список
Период
Сортировка
От Herouth Maoz
Тема Re: [SQL] Does PostgreSQL have an UPDATE Function like UNIFY?
Дата
Msg-id l03130303b376e90c1682@[147.233.159.109]
обсуждение исходный текст
Ответ на Does PostgreSQL have an UPDATE Function like UNIFY?  ("John J. Boris, Sr." <john.boris@onlinesvc.com>)
Список pgsql-sql
At 03:34 +0300 on 29/05/1999, John J. Boris, Sr. wrote:


> I can delete the records and then add them but I think that
> might be a bit time consuming.

Frankly, I don't think it will be more time consuming. Supposing a COPY
command had to do it itself, it would have to look up each record in the
table, and replace it. So it would probably mark the old one as deleted and
insert the new record. It shouldn't be much faster than:

1) Creating a temp table with the same schema as the main one
2) copying the records into the temp table
3) deleting from the main all the records which exist in the temp  table (DELETE FROM main WHERE main.field =
temp.field);
4) Inserting all records from the temp table using INSERT INTO... SELECT.
5) Dropping the temp table
6) Vacuuming

Herouth

--
Herouth Maoz, Internet developer.
Open University of Israel - Telem project
http://telem.openu.ac.il/~herutma




В списке pgsql-sql по дате отправления:

Предыдущее
От: Herouth Maoz
Дата:
Сообщение: Re: [SQL] 2 Table Select
Следующее
От: "John J. Boris, Sr."
Дата:
Сообщение: Re: [SQL] Does PostgreSQL have an UPDATE Function like UNIFY?